<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace app\assets;

use yii\web\AssetBundle;

/**
 * Main application asset bundle.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web/admin/';
    public $css = [
        'css/pace.min.css',
        // 'css/site.css',
        // 'https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css',
    ];
    public $js = [
        'js/layer/layer.js',
        'js/pace.min.js',
        'js/fastclick.js',
        // 'https://cdn.jsdelivr.net/momentjs/latest/moment.min.js',
        // 'https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js',
    ];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\bootstrap\BootstrapAsset',
    ];

    //定义按需加载css方法，注意加载顺序在最后  
    public static function addCss($view, $cssfile) {  
        $view->registerCssFile($cssfile, [AppAsset::className(), 'position' => \yii\web\View::POS_HEAD]); 
        // $view->registerCssFile($cssfile, [AppAsset::className(), 'depends' => 'backend\assets\AppAsset']);  
    }   

     //定义按需加载JS方法，注意加载顺序在最后  
    public static function addScript($view, $jsfile) {  
        $view->registerJsFile($jsfile, [AppAsset::className(), 'position' => \yii\web\View::POS_END]);
        // $view->registerJsFile($jsfile, [AppAsset::className(), 'depends' => 'backend\assets\AppAsset']);  
    }  
    
}
